package com.bigfire.dtm.shared.exception;

import com.bigfire.dtm.shared.enums.ResponseCodeEnum;
import lombok.EqualsAndHashCode;
import lombok.Value;

/**
 * 系统异常
 * @author Damon S.
 */
@Value
@EqualsAndHashCode(callSuper = true)
public class SystemException extends RuntimeException {

    Integer code;

    public SystemException(Throwable cause) {
        super(cause);
        this.code = ResponseCodeEnum.INTERNAL_ERROR.getCode();
    }

    public SystemException(String message) {
        super(message);
        this.code = ResponseCodeEnum.INTERNAL_ERROR.getCode();
    }

    public SystemException(String message, Throwable cause) {
        super(message, cause);
        this.code = ResponseCodeEnum.INTERNAL_ERROR.getCode();
    }

    @Override
    public String toString() {
        return super.toString() + super.getMessage();
    }
}

